<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>个人中心</title>
		<link rel="stylesheet" type="text/css" href="{{__PUBLIC__}}/Home/css/header.css"/>
		<link rel="stylesheet" type="text/css" href="{{__PUBLIC__}}/Home/css/footer.css"/>
		<link rel="stylesheet" type="text/css" href="{{__PUBLIC__}}/Home/css/address.css"/>
		<link rel="shortcut icon" href="{{__PUBLIC__}}/Home/images/favicon.ico">
		<script type="text/javascript" src="{{__PUBLIC__}}/Home/js/jquery-1.8.2.min.js"></script>
		<script type="text/javascript" src="{{__PUBLIC__}}/Home/js/area.js"></script>
		<script type="text/javascript" src="{{__PUBLIC__}}/Admin/hdjs/hdjs.min.js"></script>
	    <link rel="stylesheet" type="text/css" href="{{__PUBLIC__}}/Admin/hdjs/hdjs.css"/>
		<style type="text/css">
			*{
				margin: 0;
				padding: 0;
			}
		</style>
		<script type="text/javascript">
			$(function(){
				//初始化方法
				area.init('a');
				//修改的时候默认被选中效果
				area.selected('黑龙江','哈尔滨','道里区');
				//添加新地址
				$('#ok').click(function(){
					var address = String($('select[name=sheng]').val()) + String($('select[name=shi]').val()) + String($('select[name=xian]').val()) +String($('textarea[name=xiang]').val());
					var consignee = $('#holder').val();
					var postcode = $('input[name=postcode]').val();
					var mobile = $('#mobile').val();
					$.ajax({
							//请求地址
						url:"{{U('User/address')}}",
							//发送数据
						data:{address:address,consignee:consignee,postcode:postcode,mobile:mobile},
							//请求类型
						type:'post',
							//返回的数据类型
						dataType:'json',
							//成功返回
						success:function(data){
							if(data){
								location.href="{{U('index')}}";
							}
						}
					})
				})
			})
		</script>
		{{include file="VIEW_PATH/Common/header.php"}}
	
		<div class="hr-10"></div>
			<!--***************************************************top-->
		<div class="head-title-dy">
			<a href="">首页</a>\
			<a href="">我的商城</a> \
			<a href="">我的订单</a>
		</div>
		<div class="hr-10"></div>
		<div class="m-layout">
			<div class="m-left-dy">
				<div class="m-l-title"><a href="">我的商城</a></div>
				<h3><span>订单中心</span></h3>
				<ul class="m-order-dy">
					<li><a href="{{U('User/index')}}"><span>我的订单</span><em>{{$num['all']}}</em></a></li>
				</ul>
				<h3><span>个人中心</span></h3>
				<ul class="m-order-dy">
					<li><a href="{{U('User/users')}}"><span>个人信息管理</span></a></li>
					<li><a href="{{U('User/address')}}"><span>收货地址管理</span></a></li>
				</ul>
			</div>
				<!--left-over---------------->
		<!--右边部分-->
			<div class="right">
				<h2 class='title'>收货地址管理</h2>
				<!-- <form action="" method="post"> -->
				<table class='form'>
					<tr class='shoujianren'>
						<th><span>*</span>收货人：</th>
						<td>
							<input type="text" name="consignee" id="holder" />
						</td>
					</tr>
					<tr class='shouhuodizi'>
						<th><span>*</span>收货地址：</th>
						<td>
							<select name="sheng" id="a1">
								<option value="">-请选择-</option>

							</select>
							<select name="shi" id="a2">
								<option value="">-请选择-</option>

							</select>
							<select name="xian" id="a3">
								<option value="">-请选择-</option>

							</select>
						</td>
					</tr>
					<tr class='textar'>
						<th></th>
						<td>
							<textarea name="xiang" placeholder="详细地址"></textarea>
						</td>
					</tr>
					<tr class='youbian'>
						<th>邮编</th>
						<td>
							<input type="text" name="postcode" id="" />
						</td>
					</tr>
					<tr class='shoujianren'>
						<th><span>*</span>手机号码</th>
						<td>
							<input type="text" name="mobile" id="mobile" />
						</td>
					</tr>
					<tr class='default'>
						<th></th>
						<td>
							<input type="checkbox" name="default" id="" /><span></span>设为默认地址
						</td>
					</tr>
					<tr class='sub'>
						<th></th>
						<td>
							<input type="button" id="ok" value="添加新地址" />
							<a href="">清空</a>
						</td>
					</tr>
				</table>
				<!-- </form> -->
				<table class='default_msg'>
					<tr class='top'>	 		
						<th><span>收货人</span></th>
						<th><span>收货地址</span></th>
						<th><span>邮编</span></th>
						<th><span>手机/电话 </span></th>
						<th><span style='border:none'>操作</span></th>
					</tr>
					{{foreach from="$address" value="$v"}}
					<tr class='old_data'>
						<td>{{$v['consignee']}}</td>
						<td>{{$v['address']}}</td>
						<td>{{$v['postcode']}}</td>
						<td>{{$v['mobile']}}</td>
						<td>
							<a href="">编辑</a>
							<a href="">删除</a>
							<span>默认</span>
						</td>
					</tr>
					{{endforeach}}
				</table>
			</div>

		</div>
<!------------------------------底部-------------------------->
	{{include file="VIEW_PATH/Common/footer.php"}}
		
	</body>
</html>
